use std::collections::HashSet;
use std::collections::hash_map::{HashMap, Occupied, Vacant};
+use std::sync::TaskPool;
use term::color::YELLOW;
use core::{Package, PackageId, Resolve, PackageSet};
-use util::{Config, TaskPool, DependencyQueue, Fresh, Dirty, Freshness};
+use util::{Config, DependencyQueue, Fresh, Dirty, Freshness};
use util::{CargoResult, Dependency, profile};
use super::job::Job;
pub use self::errors::{process_error, internal_error, internal, human, caused_human};
pub use self::paths::{realpath, join_paths};
pub use self::hex::{to_hex, short_hash};
-pub use self::pool::TaskPool;
pub use self::dependency_queue::{DependencyQueue, Fresh, Dirty, Freshness};
pub use self::dependency_queue::Dependency;
pub use self::graph::Graph;
pub mod to_url;
pub mod toml;
mod dependency_queue;
-mod pool;
mod sha256;
mod vcs;
+++ /dev/null
-//! A load-balancing task pool.
-//!
-//! This differs in implementation from std::sync::TaskPool in that each job is
-//! up for grabs by any of the child tasks in the pool.
-//!
-//! This should be upstreamed at some point.
-
-use std::sync::{Arc, Mutex};
-
-pub struct TaskPool {
- tx: SyncSender<proc():Send>,
-}
-
-impl TaskPool {
- pub fn new(tasks: uint) -> TaskPool {
- assert!(tasks > 0);
- let (tx, rx) = sync_channel(tasks);
-
- let state = Arc::new(Mutex::new(rx));
-
- for _ in range(0, tasks) {
- let state = state.clone();
- spawn(proc() worker(&*state));
- }
-
- return TaskPool { tx: tx };
-
- fn worker(rx: &Mutex<Receiver<proc():Send>>) {
- loop {
- let job = rx.lock().recv_opt();
- match job {
- Ok(job) => job(),
- Err(..) => break,
- }
- }
- }
- }
-
- pub fn execute(&self, job: proc():Send) {
- self.tx.send(job);
- }
-}